<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
<%@taglib uri="http://www.springframework.org/tags" prefix="spring"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 

<style>
    .ui-combobox {
        position: relative;
        display: inline-block;
    }
    .ui-combobox-toggle {
        position: absolute;
        top: 0;
        bottom: 0;
        margin-left: -1px;
        padding: 0;
        /* adjust styles for IE 6/7 */
        *height: 1.7em;
        *top: 0.1em;
    }
    .ui-combobox-input {
        margin: 0;
        padding: 0.3em;
    }
</style>

<div width="950px" style="text-align:left;">
<p>客訴案件查詢 </p>

	<form id="f1" action="<c:url value="/report09/find.do"/>" method="post">
		
		流程狀態:<select name="step" >
			<option value="0"> 請選擇</option>
			<option value="1">品情登錄</option>
			<option value="2">品保指派</option>
			<option value="3">品管指派</option>
			<option value="4">初步調查</option>
			<option value="5">初步回覆</option>
			<option value="6">客訴判定</option>
			<option value="7">真因分析</option>
			<option value="8">永久對策</option>
			<option value="9">客戶確認</option>
			<option value="10">處級審核</option>
			<option value="11">追蹤確認</option>
			<option value="12">結案</option>
		</select> <br>
		
		業務/負責人員:<input type="text"  id="salesSearch">
		<input type="hidden"  id="salesId" name="salesId">
		<br>
		
		異常現象:<input type="text"  id="unusualTypeSearch">
		<input type="hidden"  id="unusualType" name="unusualType">
		<br>
		
		開單日期:<input type="text" class="date" name="startDate" value="${startDate}"><br>
		
		完成初步回覆日期:<input type="text" id="surveyDate5_start" name="surveyDate5_start" value="${surveyDate5_start }"> ~ <input type="text" id="surveyDate5_over" name="surveyDate5_over" value="${surveyDate5_over }"><br>		
		
		完成最終回覆日期:<input type="text" id="finishForeverDate8_start" name="finishForeverDate8_start" value="${finishForeverDate8_start}"> ~ <input type="text" id="finishForeverDate8_over" name="finishForeverDate8_over" value="${finishForeverDate8_over }"><br>
		
		客訴編號 ：　<input type="text" name="cdiid"  value="${cdiid }">
		　
		<br>
		
		客戶名稱 : <input type="text" id="custSearch">
		<input type="hidden" id="custId" name="custId">
		 
		產品類別:<select name="productType" >
			<option value=""> 請選擇</option>
			<c:forEach var="pe" items="${productTypeMap}">
				<c:set var="selected" value=""></c:set>
				<c:if test="${pe.key == productType }">
					<c:set var="selected" value="selected=\"selected\""></c:set>
				</c:if>
				<option value="${pe.key }" ${selected } > ${pe.value }</option>
			</c:forEach>
		</select> 
		<br>
		
		 產品品號(新):<input type="text" id="newProduct" name="newProduct" value="${newProduct }"> (最少輸入三個字)
		 <br> 
		  產品品號(舊):<input type="text" id="oldProduct" name="oldProduct" value="${oldProduct }"> (最少輸入三個字)		
		<br>
		
		生產地 :<select name="madein" >
			<option value=""> 請選擇</option>
			<c:forEach var="m" items="${madeinMap}">
				<c:set var="selected" value=""></c:set>
				<c:if test="${m.key == madein }">
					<c:set var="selected" value="selected=\"selected\""></c:set>
				</c:if>
				<option value="${m.key }"  ${selected } > ${m.value }</option>
			</c:forEach>
		</select> 
		 
		<c:if test="${determine == 'Y' }">
			<c:set var="dy" value="selected=\"selected\""></c:set>
		</c:if>
		<c:if test="${determine == 'N' }">
			<c:set var="dn" value="selected=\"selected\""></c:set>
		</c:if>  
		案件判定: <select name="determine" >
			<option value=""> 請選擇</option>
			<option value="Y" ${dy}>成立</option>
			<option value="N" ${dn}>不成立</option>
		</select>
		<br>
		<!-- 
		權責單位:<input type="text" id="orgName" >(最少輸入一個字)
		<input type="hidden" id="orgId" name="orgId">
		<br>
		 -->
		判定日:<input type="text" class="date" name="finishDetetmineDate6" value="${finishDetetmineDate6 }">
		
		
		<br>
		<input type="submit" id="doSearch" value="搜尋"  >
		
	</form>



</div>
 <script>

 $(function() {


	 // all class = date
	 $('.date').datepicker({
			dateFormat:"yy-mm-dd",
			changeMonth: true,
			changeYear: true	  	
	});
	 // surveyDate5
	 $('#surveyDate5_start').datepicker({
			dateFormat:"yy-mm-dd",
			changeMonth: true,
			changeYear: true,
			onSelect: function( selectedDate ) {
             $( "#surveyDate5_over" ).datepicker( "option", "minDate", selectedDate );
             $( "#surveyDate5_over" ).val(selectedDate);
         }
		});
	$("#surveyDate5_start").keypress(function(event) {event.preventDefault();});
	$('#surveyDate5_over').datepicker({
		dateFormat:"yy-mm-dd",
		changeMonth: true,
		changeYear: true,
		onSelect: function( selectedDate ) {
            $( "#surveyDate5_start" ).datepicker( "option", "maxDate", selectedDate );
        }
	});
	$("#surveyDate5_over").keypress(function(event) {event.preventDefault();});
	
	 // finishForeverDate8
	 $('#finishForeverDate8_start').datepicker({
			dateFormat:"yy-mm-dd",
			changeMonth: true,
			changeYear: true,
			onSelect: function( selectedDate ) {
            $( "#finishForeverDate8_over" ).datepicker( "option", "minDate", selectedDate );
            $( "#finishForeverDate8_over" ).val(selectedDate);
        }
		});
	$("#finishForeverDate8_start").keypress(function(event) {event.preventDefault();});
	$('#finishForeverDate8_over').datepicker({
		dateFormat:"yy-mm-dd",
		changeMonth: true,
		changeYear: true,
		onSelect: function( selectedDate ) {
           $( "#finishForeverDate8_start" ).datepicker( "option", "maxDate", selectedDate );
       }
	});
	$("#finishForeverDate8_over").keypress(function(event) {event.preventDefault();});
	 
 
 $( "#custSearch" ).autocomplete({
		source: '<c:url value="/ajax/cust.do" />',
		minLength: 2,
		select: function( event, ui ) {	
			$('#custId').val(ui.item.postValue);
			$(this).val(ui.item.label);
		}	
	});

 $( "#newProduct" ).autocomplete({
		source: '<c:url value="/ajax/newProduct.do" />',
		minLength: 3,
		select: function( event, ui ) {	
			$(this).val(ui.item.postValue);
		}	
	});	

 $( "#oldProduct" ).autocomplete({
		source: '<c:url value="/ajax/oldProduct.do" />',
		minLength: 3,
		select: function( event, ui ) {	
			$(this).val(ui.item.postValue);
		}	
	});

 $( "#orgName" ).autocomplete({
		source: '<c:url value="/ajax/orgName.do" />',
		minLength: 1,
		select: function( event, ui ) {	
			$(this).val(ui.item.postValue);
			$('#orgId').val(ui.item.postValue);
		}	
	});

 $( "#salesSearch" ).autocomplete({
		source: '<c:url value="/ajax/sales.do" />',
		minLength: 1,
		select: function( event, ui ) {	
			$('#salesId').val(ui.item.postValue);
			$(this).val(ui.item.label);
		}	
	});		 

 $( "#unusualTypeSearch" ).autocomplete({
		source: '<c:url value="/ajax/unusualType.do" />',
		minLength: 2,
		select: function( event, ui ) {	
			$('#unusualType').val(ui.item.postValue);
			$(this).val(ui.item.label);
		}	
	});		 
 
 

 });
 </script>
    
